package org.ns.summer.beans.anns;

public class ComponentUtils {

    public static String getBeanName(String classname, Component component) {
        String beanName = component == null? "" : component.value().trim();
        if (beanName.isEmpty()) {
            int index = classname.lastIndexOf(".");
            if (index == -1) {
                beanName = classname;
            } else {
                beanName = classname.substring(index + 1, index + 2).toLowerCase() + classname.substring(index + 2);
            }
        }
        return beanName;
    }
}

